{"ast":null,"code":"import React from'react';import ReactDOM from\"react-dom\";import\"./Modal.scss\";import{Button}from\"../index\";import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";import{Fragment as _Fragment}from\"react/jsx-runtime\";var Modal=function Modal(_ref){var active=_ref.active,title=_ref.title,_ref$hasFunctionButto=_ref.hasFunctionButtons,hasFunctionButtons=_ref$hasFunctionButto===void 0?false:_ref$hasFunctionButto,onSubmit=_ref.onSubmit,onClose=_ref.onClose,_ref$customClassNameB=_ref.customClassNameButtonFirst,customClassNameButtonFirst=_ref$customClassNameB===void 0?'':_ref$customClassNameB,_ref$customClassNameB2=_ref.customClassNameButtonSecond,customClassNameButtonSecond=_ref$customClassNameB2===void 0?'':_ref$customClassNameB2,children=_ref.children;if(active){var portalElement=document.getElementById('root');if(portalElement){return/*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/_jsx(\"div\",{className:\"modal\",onClick:onClose,children:/*#__PURE__*/_jsxs(\"div\",{className:\"modal__content\",onClick:function onClick(event){return event.stopPropagation();},children:[/*#__PURE__*/_jsx(\"div\",{className:\"modal__header\",children:/*#__PURE__*/_jsx(\"div\",{className:\"modal__title\",children:title})}),/*#__PURE__*/_jsx(\"div\",{className:\"modal__body\",children:children}),hasFunctionButtons&&/*#__PURE__*/_jsxs(\"div\",{className:\"modal__footer\",children:[/*#__PURE__*/_jsx(Button,{fullWidth:false,text:'Отмена',customClassName:\"modal__button\"+\" \"+customClassNameButtonFirst,callback:onClose}),/*#__PURE__*/_jsx(Button,{fullWidth:false,text:'Подтвердить',customClassName:\"modal__button\"+\" \"+customClassNameButtonSecond,callback:onSubmit})]})]})}),portalElement);}else{return/*#__PURE__*/_jsx(_Fragment,{});}}else{return/*#__PURE__*/_jsx(_Fragment,{});}};export default Modal;","map":{"version":3,"names":["React","ReactDOM","Button","Modal","active","title","hasFunctionButtons","onSubmit","onClose","customClassNameButtonFirst","customClassNameButtonSecond","children","portalElement","document","getElementById","createPortal","event","stopPropagation"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/src/components/Modal/index.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from \"react-dom\";\nimport {IModalProps} from \"../../models/props/IModalProps\";\nimport \"./Modal.scss\";\nimport {Button} from \"../index\";\n\nconst Modal: React.FC <React.PropsWithChildren<IModalProps>> = (\n    {\n        active,\n        title,\n        hasFunctionButtons = false,\n        onSubmit,\n        onClose,\n        customClassNameButtonFirst = '',\n        customClassNameButtonSecond = '',\n        children\n    }) => {\n    if (active) {\n        const portalElement = document.getElementById('root');\n\n        if (portalElement) {\n            return ReactDOM.createPortal(\n                <div className=\"modal\" onClick={onClose}>\n                    <div className=\"modal__content\" onClick={event => event.stopPropagation()}>\n                        <div className=\"modal__header\">\n                            <div className=\"modal__title\">{title}</div>\n                        </div>\n                        <div className=\"modal__body\">{children}</div>\n                        {(hasFunctionButtons &&\n                            <div className=\"modal__footer\">\n                                <Button\n                                    fullWidth={false}\n                                    text={'Отмена'}\n                                    customClassName={\"modal__button\" + \" \" + customClassNameButtonFirst}\n                                    callback={onClose}\n                                />\n                                <Button\n                                    fullWidth={false}\n                                    text={'Подтвердить'}\n                                    customClassName={\"modal__button\" + \" \" + customClassNameButtonSecond}\n                                    callback={onSubmit}\n                                />\n                            </div>\n                        )}\n                    </div>\n                </div>,\n                portalElement\n            );\n        }\n        else {\n            return (<></>);\n        }\n    } else {\n        return (<></>);\n    }\n}\n\nexport default Modal;\n"],"mappings":"AAAA,MAAOA,MAAK,KAAM,OAAO,CACzB,MAAOC,SAAQ,KAAM,WAAW,CAEhC,MAAO,cAAc,CACrB,OAAQC,MAAM,KAAO,UAAU,CAAC,6IAEhC,GAAMC,MAAsD,CAAG,QAAzDA,MAAsD,MAUlD,IARFC,OAAM,MAANA,MAAM,CACNC,KAAK,MAALA,KAAK,4BACLC,kBAAkB,CAAlBA,kBAAkB,gCAAG,KAAK,uBAC1BC,QAAQ,MAARA,QAAQ,CACRC,OAAO,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